package com.fallsvc.re.javasesets.jdk17;

sealed class Animal permits Dog {
    public String name;
    public int age;

    public void eat() {
        System.out.println("eat()....");
    }
}


//继承的类也要加上密封限制 non-sealed 表⽰不限制
non-sealed class Dog extends Animal{
    @Override
    public void eat() {
        System.out.println(this.name+ "正在吃狗粮....");
    }
}